package cn.wolfcode.luowowo.util;


import lombok.Data;
import lombok.Getter;

@Getter
//使用枚举操作keys
public enum RedisKeys {
    //key
    TOKEN_CODE("token_code",Consts.USER_INFO_TOKEN_VAI_TIME*60L),
    VERIFY_CODE("verify_code",Consts.VERIFY_CODE_VAI_TIME*60L);
    //前缀和时间
    private String prefix;
    private Long time;
    //构造器
    private RedisKeys(String prefix,Long time){
        this.prefix=prefix;
        this.time=time;
    }
    //拼接出key的方式
    public String join(String... value){
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(this.prefix);
        //遍历
        for(String ele : value){
            stringBuilder.append(":").append(ele);
        }
        return stringBuilder.toString();
    }

    /*//验证
    public static void main(String[] args) {
        System.out.println(RedisKeys.VERIFY_CODE.join("1343535","22333","444"));
    }*/

}
